package com.pospi.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.pospi.dto.GoodsDto;
import com.pospi.dto.OrderDto;
import com.pospi.pai.yunpos.R;
import com.pospi.util.Sava_list_To_Json;

import java.util.List;

/**
 * Created by acer on 2018/8/7.
 */

public class RefundDialogAdapter extends BaseAdapter {
    private Context context;
    private List<GoodsDto> orderDtos;

    public RefundDialogAdapter(Context context, List<GoodsDto> orderDtos) {
        this.context = context;
        this.orderDtos = orderDtos;
    }

    @Override
    public int getCount() {
        return orderDtos.size();
    }

    @Override
    public Object getItem(int position) {
        return orderDtos.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
//        Holder holder;
//        if (convertView == null) {
//            holder = new Holder();
//            convertView = LayoutInflater.from(context).inflate(R.layout.rest_order_dialog_item, null);
//            holder.ddh = convertView.findViewById(R.id.rest_ddh_item);
//            holder.ddsj = convertView.findViewById(R.id.rest_ddsj_item);
//            holder.ddje = convertView.findViewById(R.id.rest_ddje_item);
//            holder.ddxq = convertView.findViewById(R.id.rest_ddxq_item);
//            convertView.setTag(holder);
//
//        } else {
//            holder = (Holder) convertView.getTag();
//        }
//        holder.ddh.setText(orderDtos.get(position).getMaxNo());
//        holder.ddsj.setText(orderDtos.get(position).getCheckoutTime());
//        holder.ddje.setText(orderDtos.get(position).getYs_money());
//        List<GoodsDto> list = Sava_list_To_Json.changeToList(orderDtos.get(position).getOrder_info());
//
//        holder.ddxq.setText(list.get(0).getName());
        return convertView;
    }
    class Holder{
        TextView ddh;
        TextView ddsj;
        TextView ddje;
        TextView ddxq;
    }
}
